﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using RestEntities;

namespace WpfAppWcfRestConsumer.Views
{
	/// <summary>
	/// Interaction logic for AddCommentWindow.xaml
	/// </summary>
	public partial class AddCommentWindow : Window
	{
		public AddCommentWindow()
		{
			InitializeComponent();
			CommentData = new Comment(DateTime.Now);
			CommentData.CommentBody = "add body here ....";
			CommentData.CommentHead = "add head here ....";
			this.DataContext = CommentData;
		}

		public AddCommentWindow(Comment comment)
		{
			InitializeComponent();

			this.btnAdd.Content = "Update";
			this.Title = "Update comment";

			CommentData = comment;
			this.DataContext = CommentData;
		}

		public Comment CommentData
		{
			get;
			set;
		}

		private void btnAdd_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = true;
		}

		private void btnCancel_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = false;
			this.Close();
		}
	}
}
